<div class="content_eee">
	<div class="register">
    	<div class="register_s">
        	<div class="anquan">
            	<h1>悠奇网安全中心</h1><i>-</i><h2>找回密码</h2>
                <span><a href="/user/login">返回登录页</a></span>
            </div>
            <div class="buzhou">
                <ul class="bzthree">
                	<li class="ed">1. 输入注册邮箱</li>
                	<li class="ed">2. 进邮箱验证身份</li>
                	<li class="lv">3. 重置密码</li>
                	<li>4. 完成</li>
                </ul>
            </div>
            <?php if($this->flag == 1){?>
			<div class="newpassword">
            	<h2>您已顺利通过邮箱验证，请设置您的新密码！</h2>
            	<form id="form1" method="post">
            	<input type="hidden" id="hidUserId" value='<?php echo $this->uid;?>' />
                <div class="newtable">
                	<table>
                        <tr>
                            <td class="zuo">输入新密码：</td>
                            <td>
                                <div class="input k300">
                                    <input type="password" id="password1" onchange="check_form()" /><label id="password1Msg" for="newpostcode" generated="true" class="error" style="display: block; "></label>
                                </div>
                                <p>6~16个字符，区分大小写</p>
                            </td>
                        </tr>
                        <tr>
                            <td class="zuo">确认新密码：</td>
                            <td>
                                <div class="input k300">
                                    <input  type="password" id="password2" onchange="check_form()" /><label id="password2Msg" for="newpostcode" generated="true" class="error" style="display: block; "></label>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="submit">
                    <a class="next" href="javascript:form_submit();"><span>确认提交</span></a>
                </div>
                </form>
            </div>
            <?php } else {?>
			<div class="newpassword">
				<h2><font color="red"><?php echo $this->error;?></font></h2>
			</div>
			<?php }?>
        </div>
    </div>
</div>

<script language="javascript">
function form_submit()
{
	if(check_form())
	{
		var password1 = $("#password1").val();
		var password2 = $("#password2").val();
		var uid = $("#hidUserId").val();

		//$("#form1").submit();return;
		jQuery.ajax({
            type: "POST",
            url: "/user/retakepasswordthree/",
            data: {"password1":password1,"password2":password2,"uid":uid},
            dataType:"json",
            success: function(obj){
            	if(obj.ret == 1)
    			{
	    			window.location.href = "/user/retakepasswordfour";
    			}
    			else
    			{
	    			switch(obj.ret)
	    			{
	    				case -1:
	    					$("#checkCodeMsg").html("重置密码失败");
	    					$("#checkCodeMsg").show();
		    				break;
	    			}
    			}
            }
        });
	}
}

function check_form()
{
	if($("#password1").val() == "")
	{
		$("#password1Msg").html("必填项");
		$("#password1Msg").show();

		return false;
	}
	else
	{
		$("#password1Msg").html("");
		$("#password1Msg").hide();
	}

	if($("#password2").val() == "")
	{
		$("#password2Msg").html("必填项");
		$("#password2Msg").show();

		return false;
	}
	else
	{
		$("#password2Msg").html("");
		$("#password2Msg").hide();
	}	

	if($("#password1").val() != $("#password2").val())
	{
		$("#password2Msg").html("输入的两次密码不一致");
		$("#password2Msg").show();

		return false;
	}
	else
	{
		$("#password2Msg").html("");
		$("#password2Msg").hide();
	}
	
	return true;
}
</script>